<?php
namespace App\Models\V6;
use DB;
use App\Models\V1\BaseModel;


class ArticleModel extends BaseModel{

    /**
     * 添加文章内容
     * */
    public function add_article(){

    }

    /**
     * 编辑文章
     * */
    public function edit_article(){

    }

    /**
     * 删除文章
     * */
    public function delete_article(){

    }


    /**
     * 获取文章详情
     *
     * */
    public function get_article_detail(){

    }

    /**
     * 评论文章
     *
     * */
    public function add_comemnt(){

    }

    /**
     * 获取文章评论列表
     * */
    public function get_comment_list(){

    }

    /**
     * 添加文章查看日志
     * */
    public function add_article_view_log(){

    }



    /**
     * 获取文章列表
     * @param $perNumber integer 每页的数量
     * */
    public function get_articles($perNumber=20){
        $articles = DB::table('mindshare')
            ->select('MinSgaID', 'MinSgaTitle', 'MinSgaDesc', 'FilePath1', 'AddDate','view_times')
            ->where('IsShow', '1')
            ->where('DeleteMark', '1')
            ->orderBy('ReleaseDate', 'desc')
            ->paginate($perNumber);
        foreach ($articles as $shareDate) {
            $shareDate->FilePath1   = env('ADMIN_HOST') . $shareDate->FilePath1;
            $shareDate->urlAddress  = env('ADMIN_HOST') . "/sharedetail/" . $shareDate->MinSgaID . ".html";
        }
        return $articles;
    }
}